<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:;">所有工单</a></li>
        <li><a href="{:url('Order/addOrder')}">下单</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminArticle/index')}">
        分类:
        <select class="form-control" name="type" style="width: 140px;">
            <option value='orderNum'>工单号</option>
            <option value='userTel'>用户电话</option>
            <option value='orderName'>用户名称</option>
            <option value='userAddress'>用户地址</option>
        </select> &nbsp;&nbsp;
        工单状态:
        <select class="form-control" name="orderStatus" style="width: 140px;">
            <option value='0'>待分解</option>
            <option value='1'>进行中</option>
            <option value='2'>完成</option>
            <option value='3'>欠费</option>
            <option value='-1'>废弃</option>
        </select> &nbsp;&nbsp;
        时间搜索:
        <select class="form-control" name="orderStatus" style="width: 140px;">
            <option value='createTime'>下单时间</option>
            <option value='orderEndTime'>完成时间</option>
            <option value='orderStartTime'>开始时间</option>
        </select> &nbsp;&nbsp;
        时间:
        <input type="text" class="form-control js-bootstrap-datetime" name="start_time"
               value=""
               style="width: 140px;" autocomplete="off">-
        <input type="text" class="form-control js-bootstrap-datetime" name="end_time"
               value=""
               style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
        关键字:
        <input type="text" class="form-control" name="keyword" style="width: 200px;"
               value="" placeholder="请输入关键字...">
        <input type="submit" class="btn btn-primary" value="搜索"/>
    </form>
    <form class="js-ajax-form" action="" method="post">
        <div class="table-actions">
            <notempty name="category">
                <button class="btn btn-primary btn-sm js-ajax-submit" type="submit"
                        data-action="{:url('AdminArticle/listOrder')}">{:lang('SORT')}
                </button>
            </notempty>
            <button class="btn btn-primary btn-sm js-ajax-submit" type="submit"
                    data-action="{:url('AdminArticle/publish',array('yes'=>1))}" data-subcheck="true">发布
            </button>
        </div>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="15">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <notempty name="category">
                    <th width="50">{:lang('SORT')}</th>
                </notempty>
                <th width="50">ID</th>
                <th>工单号</th>
                <th>工单用户</th>
                <th width="50">用户电话</th>
                <th width="65">地址</th>
                <th width="65">装修风格</th>
                <th width="160">总金额</th>
                <th width="130">下单时间</th>
                <th width="130">工单开始时间</th>
                <th width="130">总周期</th>
                <th width="70">工单状态</th>
                <th width="90">操作</th>
            </tr>
            </thead>
            <foreach name="list" item="vo">
                <tr>
                    <td>
                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo.id}" title="ID:{$vo.id}">
                    </td>
                    <td>{$vo.id}</td>
                    <td>{$vo.orderNum}</td>
                    <td>{$vo.orderName}</td>
                    <td>{$vo.userTel}</td>
                    <td>{$vo.userAddress}</td>
                    <td>{$vo.orderType}</td>
                    <td>{$vo.orderTotal}</td>
                    <td>{:date('Y-m-d H:i',$vo['createTime'])}</td>
                    <td>{:date('Y-m-d H:i',$vo['orderStartTime'])}</td>
                    <td>{$vo.orderCycle}天</td>
                    <td>{$vo.orderStatus}</td>

                    <td>
                        <a href="{:url('AdminArticle/edit',array('id'=>$vo['id']))}">废弃</a>
                        <input type="hidden" value="{:url('addTask',array('id'=>$vo['id']))}" id="addTask{$vo.id}"/>
                        <a href="javascript:;"  onclick="addTask({$vo['id']})" >{:lang('FENJIE')}</a>
                    </td>
                </tr>
            </foreach>
        </table>
        <ul class="pagination">{$page|default=''}</ul>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>

    function reloadPage(win) {
        win.location.reload();
    }

    $(function () {
        setCookie("refersh_time", 0);
        Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
            //批量复制
            $('.js-articles-copy').click(function (e) {
                var ids = [];
                $("input[name='ids[]']").each(function () {
                    if ($(this).is(':checked')) {
                        ids.push($(this).val());
                    }
                });

                if (ids.length == 0) {
                    art.dialog.through({
                        id: 'error',
                        icon: 'error',
                        content: '您没有勾选信息，无法进行操作！',
                        cancelVal: '关闭',
                        cancel: true
                    });
                    return false;
                }

                ids = ids.join(',');
                art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {
                    title: "批量复制",
                    width: "300px"
                });
            });
            //批量移动
            $('.js-articles-move').click(function (e) {
                var ids = [];
                $("input[name='ids[]']").each(function () {
                    if ($(this).is(':checked')) {
                        ids.push($(this).val());
                    }
                });

                if (ids.length == 0) {
                    art.dialog.through({
                        id: 'error',
                        icon: 'error',
                        content: '您没有勾选信息，无法进行操作！',
                        cancelVal: '关闭',
                        cancel: true
                    });
                    return false;
                }

                ids = ids.join(',');
                art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
                    title: "批量移动",
                    width: "300px"
                });
            });
        });
    });
    function addTask(id) {
        var url =  $("#addTask"+id).val();
        layer.open({
            type: 2,
            title: '弹窗',
            maxmin: true,
            shadeClose: true,
            area: ['840px', '560px'],
            content:url,
        })
    }
</script>
</body>
</html>